package com.wxxymaker.edu.utils;

import java.util.Base64;

/**
 * @AUTHOR soft
 * @DATE 2018/9/5 16:23
 * @DESCRIBE base64加密工具
 */
public class BaseKit {

    public static String to(String string) {
        if (string == null) return null;
        Base64.Encoder encoder = Base64.getEncoder();
        return encoder.encodeToString(string.getBytes());
    }

    public static String from(String base64) {
        if (base64 == null) return null;
        Base64.Decoder decoder = Base64.getDecoder();
        return new String(decoder.decode(base64));
    }
}
